package designPattern.StrategyPattern;

import designPattern.StrategyPattern.i.AttackBehavior;
import designPattern.StrategyPattern.i.DefendBehavior;
import designPattern.StrategyPattern.i.DisplayBehavior;
import designPattern.StrategyPattern.i.RunBehavior;

/**
 * @author jiangwz
 * @create 2019/10/30.
 */
public abstract class Role {

    protected String name;

    private DisplayBehavior displayBehavior;
    private AttackBehavior attackBehavior;
    private DefendBehavior defendBehavior;
    private RunBehavior runBehavior;

    public void display() {
        displayBehavior.display();
    }

    public void defend() {
        defendBehavior.defend();
    }

    public void attack() {
        attackBehavior.attack();
    }

    public void run() {
        runBehavior.run();
    }

    public String getName() {
        return name;
    }

    public Role setName(String name) {
        this.name = name;
        return this;
    }

    public DisplayBehavior getDisplayBehavior() {
        return displayBehavior;
    }

    public Role setDisplayBehavior(DisplayBehavior displayBehavior) {
        this.displayBehavior = displayBehavior;
        return this;
    }

    public AttackBehavior getAttackBehavior() {
        return attackBehavior;
    }

    public Role setAttackBehavior(AttackBehavior attackBehavior) {
        this.attackBehavior = attackBehavior;
        return this;
    }

    public DefendBehavior getDefendBehavior() {
        return defendBehavior;
    }

    public Role setDefendBehavior(DefendBehavior defendBehavior) {
        this.defendBehavior = defendBehavior;
        return this;
    }

    public RunBehavior getRunBehavior() {
        return runBehavior;
    }

    public Role setRunBehavior(RunBehavior runBehavior) {
        this.runBehavior = runBehavior;
        return this;
    }
}
